////
//
/// \file ./include/inc/parser/if_statement_node.hpp
//
//  Copyright 2007, 2008 Chandler Carruth
//
//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
//  use this file except in compliance with the License.  You may obtain a copy
//  of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
//  License for the specific language governing permissions and limitations
//  under the License.
//
////

#ifndef inc_parser_if_statement_node_header
#define inc_parser_if_statement_node_header

#include <string>

#include <boost/scoped_ptr.hpp>

#include <inc/parser/parse_tree_node.hpp>

namespace inc {
namespace parser {

class ExpressionNode;
class StatementNode;
class WSParser;

/// \brief  If-Statement parse node
/// \author Chandler Carruth
/// \date   2007.07.28
///
/// This is the parse node for a conditionally guarded statement, or an "if, 
/// then" statement. This is *not* to be confused with more traditional usage 
/// of the term "if statement" to refer to the C/C++ "if" statement which 
/// often begins a block of conditionally guarded code, rather than a single
/// statement. This is a *single* guarded statement. No other flow control
/// constructs can appear within the statement, no nesting of flow can be
/// achieved. There is a hard syntactical and semantic distinction between
/// a single guarded statement and a conditionally entered block. This also
/// provides an convenient mechanism to express conditional stores and the like
/// with a more "structured" feel.

class IfStatementNode : public ParseTreeNode
{
public:
  IfStatementNode();
  virtual ~IfStatementNode();

  virtual bool parse( const iterator& first,
                      const iterator& last,
                      iterator& last_parsed );

  virtual ExpressionNode* get_expression() const;
  virtual StatementNode* get_statement() const;

private:
  boost::scoped_ptr<ExpressionNode> expr;
  boost::scoped_ptr<StatementNode> stmt;

  boost::scoped_ptr<WSParser> ws;
};

} //  end parser namespace
} //  end inc namespace
#endif  //  inc_parser_if_statement_node_header
